package com.suemi.missile.common.utils;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.suemi.missile.common.entity.ESDocument;
import org.apache.commons.io.IOUtils;

import java.io.IOException;

public class Constants {
  public static String ES_HOST = "localhost";
  public static int ES_PORT = 9300;
  public static String ES_CLUSTER = "elasticsearch_suemi";

  public static String INDEX_NAME = "patents";
  public static String INDEX_TYPE = "patent_type";

  public static JSONObject INDEX_MAPPING = ESDocument.genIndexMapping();

  public static JSONObject INDEX_SETTING = new JSONObject();

  static {
    try {
      String jsonstr = IOUtils.toString(Constants.class.getClassLoader().getResource("index_setting.json"));
      INDEX_SETTING = JSON.parseObject(jsonstr);
    } catch (IOException err) {
      INDEX_SETTING = new JSONObject();
    }
  }
}
